package com.kkb.pojo;

import java.util.List;

public class LoginData<T> {
    private Integer status; // 1成功 -1失败
    private Integer code; //返回的页面的状态码
    private String msg; //返回的信息（一般为错误信息，或异常信息）
    private List<T> list; //返回的数据有可能是集合
    private T obj;  //返回的数据有可能是单个对象

    //初始化
    public LoginData() {
        status = 1; //默认为1成功
        code = 200; //数据正常
        msg = "OK";
        list = null;
        obj = null;
    }

    public LoginData(Integer status, Integer code, String msg) {
        this.status = status;
        this.code = code;
        this.msg = msg;
    }

    public LoginData(Integer status, Integer code, String msg, List<T> list) {
        this.status = status;
        this.code = code;
        this.msg = msg;
        this.list = list;
    }

    public LoginData(Integer status, Integer code, String msg, T obj) {
        this.status = status;
        this.code = code;
        this.msg = msg;
        this.obj = obj;
    }

    @Override
    public String toString() {
        return "LoginData{" +
                "status=" + status +
                ", code=" + code +
                ", msg='" + msg + '\'' +
                ", list=" + list +
                ", obj=" + obj +
                '}';
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }
}
